package com.account.dao;

import com.account.entity.Account;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository(value = "accountDao")
@Mapper
public interface AccountDao {

    @Insert("insert into account(id,name, money,msg) values(#{id},#{name}, #{money},#{msg})")
    int add(@Param("name") String name, @Param("money") double money, @Param("msg") String msg,@Param("id") String id);

    @Update("update account set name = #{name}, money = #{money} where id = #{id}")
    int update(@Param("name") String name, @Param("money") double money, @Param("id") int  id);

    @Delete("delete from account where id = #{id}")
    int delete(int id);

    @Select("select id, name as name, money as money from account where id = #{id}")
    Account findAccount(@Param("id") int id);

    @Select("select id, name as name, money as money from account")
    List<Account> findAccountList();

}